#include <stdio.h> // snprintf,printf, va_list
#include <errno.h> // global variable errno

#include <sys/types.h> 
#include <sys/socket.h>
/* 
    some historical(BSD) implementations required <sys/types.h> 
    common: socket
    client: conncet
    server: bind, listen, accept
*/

#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h> /* superset of previous */

#include <string.h> // strlen
#include <stdlib.h> // exit

#include <arpa/inet.h>  // inet_pton
#include <unistd.h> // read


#define MAXLINE 4096
#define	LISTENQ	1024	/* 2nd argument to listen() */

typedef	struct sockaddr SA;

/*wrap socket*/
int		 Socket(int, int, int);

void	 Connect(int, const SA *, socklen_t);

void	 Bind(int, const SA *, socklen_t);
void     Listen(int fd, int backlog);
int		 Accept(int, SA *, socklen_t *);
void     Inet_pton(int family, const char *strptr, void *addrptr);

ssize_t  Read(int fd, void *ptr, size_t nbytes);    // long int 8 Bit
void     Write(int fd, void *ptr, size_t nbytes);

void     Close(int fd);

/*error solve*/
void err_sys(const char *fmt, ...);
void err_quit(const char *fmt, ...);
